home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.3 (Developer)…68k, x86, SPARC, PA-RISC] / NeXTSTEP 3.3 Dev Intel.iso / NextDeveloper / Headers / driverkit / IODeviceInspector.h < prev    next >
Text File  |  1994-08-05  |  4KB  |  117 lines

  1. /*
  2. ** IODeviceInspector - Inspects IRQ, DMA, port addrs, and mem maps
  3. **
  4. ** This object provides a default implementation of a device inspector.
  5. ** If the driver for which you need to write an inspector is sufficiently
  6. ** strange, you may write a completely new inspector.  Only the methods
  7. ** in the IOConfigurationInspector protocol need be implemented.
  8. **
  9. ** This inspector handles the arbitration of IRQ levels, DMA channels, 
  10. ** and the various address ranges.  If you need to add more controls to 
  11. ** the inspector window, override the init method, load your supplemental
  12. ** nib file, and use the setAccessoryView: method to install it in the
  13. ** UI.
  14. ** 
  15. ** By default, this inspector determines the number of IRQ levels, DMA
  16. ** channels, etc. by examining the first table it is provided with.  To
  17. ** override this behavrio, override init, call [super init], 
  18. ** then [self setNumInterrupts...].
  19. **
  20. ** To use this object with a different nib file, override loadMainNibFile.
  21. **
  22. ** Copyright 1993 by NeXT Computer, Inc.  All Rights Reserved.
  23. */
  24.  
  25. #import <appkit/appkit.h>
  26.  
  27. #define    IO_FIRST_INTERRUPT        1
  28. #define IO_NUM_INTERRUPTS        15
  29. #define IO_FIRST_CHANNEL        0
  30. #define IO_NUM_CHANNELS            8
  31. #define IO_MAX_DEVICES            32
  32. #define IO_MAX_RANGES_PER_DEVICE    16
  33.  
  34. #define IO_MAX_RANGES        (IO_MAX_DEVICES * IO_MAX_RANGES_PER_DEVICE)
  35.  
  36. #define IO_INTERRUPTS_KEY    "IRQ Levels"
  37. #define IO_CHANNELS_KEY        "DMA Channels"
  38. #define IO_PORT_RANGES_KEY    "I/O Ports"
  39. #define IO_MEMORY_RANGES_KEY    "Memory Maps"
  40. #define IO_VALID_INTERRUPTS_KEY    "Valid IRQ Levels"
  41. #define IO_VALID_CHANNELS_KEY    "Valid DMA Channels"
  42. #define IO_VERSION_KEY        "Version"
  43.  
  44. typedef enum { 
  45.     IO_ConflictUnknown = 0, IO_NoConflict, IO_ConflictExists 
  46. } IOConfigurationConflict;
  47.  
  48. typedef struct IOAddressRange
  49. {
  50.     unsigned    start;
  51.     unsigned    length;
  52. } IOAddressRange;
  53.     
  54. typedef struct IOResources
  55. {
  56.     BOOL        interrupts[IO_NUM_INTERRUPTS];
  57.     BOOL        channels[IO_NUM_CHANNELS];
  58.     unsigned        numPortRanges;
  59.     IOAddressRange      portRanges[IO_MAX_RANGES];
  60.     unsigned        numMemoryRanges;
  61.     IOAddressRange    memoryRanges[IO_MAX_RANGES];
  62. } IOResources;
  63.  
  64. @protocol IOConfigurationInspector
  65. - setTable:(NXStringTable *)instance;
  66. - (View *) inspectionView;
  67. - resourcesChanged:(IOResources *)rsrc;
  68. @end
  69.  
  70. @interface IODeviceInspector:Object <IOConfigurationInspector>
  71. {
  72.     id    accessoryHolder;        /* View where we put accessory */
  73.     id    statusTitle;            /* At top of window */
  74.     id  origWindow;            /* For getting contentView */
  75.     
  76.     id  dmaBox;                /* In case no DMA channels */
  77.     id    dmaMatrix;            /* Buttons for DMA channels */
  78.     id  irqBox;                /* In case no IRQ levels */
  79.     id    irqMatrix;            /* Buttons for IRQ levels */
  80.     id    memoryBox;            /* In case no mapped memory */
  81.     id    memoryController;        /* Handles ranges */
  82.     id    portsBox;            /* In case no port addresses */
  83.     id    portsController;        /* Handles ranges */
  84.     
  85.     id  inspectionView;            /* The inspection view */
  86.     id  versionTitle;            /* Text for driver version */
  87.     id  infoPanel;            /* Text about the device */
  88.     id  infoText;            /* Text object for info file */
  89.         
  90.     NXStringTable  *table;        /* Device we're editing */
  91.     int           numInterrupts;    /* How many IRQ's to configure */
  92.     int           numChannels;        /* How many DMA's to configure */
  93.     int           portRangeLength;    /* Port address size */
  94.     int           memoryRangeLength;    /* Memory map size */
  95.     
  96.     BOOL       infoTextLoaded;    /* Info panel has been loaded */
  97.     BOOL       knowsDetails;    /* Knows device's requirements */
  98.     
  99.     /* Conflict status on last update, used to minimize redraws */
  100.     
  101.     IOConfigurationConflict    portConflict;    /* Had conflict w/portaddrs? */
  102.     IOConfigurationConflict    memoryConflict;    /* Had conflict w/memmap? */
  103.     IOConfigurationConflict    totalConflict;    /* Any conflicts at all? */
  104. }
  105.  
  106. - setNumInterrupts:(int)nirq numChannels:(int)ndma portRangeLength:(int)nport 
  107.     memoryRangeLength:(int)nmap;
  108. - loadMainNibFile;
  109. - setAccessoryView:aView;
  110.  
  111. - channelOrInterruptPicked:sender;
  112. - showInfo:sender;
  113.  
  114. - rangeDidChange:sender;
  115.  
  116. @end
  117.